#include <iostream>
#include <iomanip>
#include <string>
using namespace std;

string ReturnRepeatedString(const string repeater, const int times) {
    string result = "";
    for (int i = 0; i < times; i++) {
        result.append(repeater);
    }
    return result;
}

int ReturnDigitCnt(int num) {
    string numStr = to_string(num);
    return numStr.size();
}

int main(){
    int base1, base2;
    int result;
    cin >> base1 >> base2;
    result = base1 * base2;
    int length = ReturnDigitCnt(result) + 1;
    cout << setw(length) << base1 << endl;
    cout << "x" << setw(length - 1) << base2 << endl;
    cout << ReturnRepeatedString("-", length) << endl;
    int lengthBase2 = ReturnDigitCnt(base2);
    for (int i = 0; i < lengthBase2; i++) {
        int currDigit = base2 % 10;
        base2 /= 10;
        int currMultResult = base1 * currDigit;
        cout << (i == lengthBase2 - 1 ? "+" : "") <<
        setw(length - i - (i == lengthBase2 - 1 ? 1 : 0)) << currMultResult << endl;
    }
    cout << ReturnRepeatedString("-", length) << endl;
    cout << setw(length) << result << endl;
}